package com.kakarote.hrm.constant;

/**
 * 招聘计划状态枚举
 *
 * @author system
 * @since 2024-01-01
 */
public enum RecruitPlanStatusEnum {
    
    /**
     * 待上报
     */
    PENDING_REPORT(0, "待上报"),
    
    /**
     * 上报审核
     */
    UNDER_REVIEW(1, "上报审核"),
    
    /**
     * 上报通过
     */
    APPROVED(2, "上报通过"),
    
    /**
     * 上报驳回
     */
    REJECTED(3, "上报驳回");
    
    private final Integer status;
    private final String name;
    
    RecruitPlanStatusEnum(Integer status, String name) {
        this.status = status;
        this.name = name;
    }
    
    public Integer getStatus() {
        return status;
    }
    
    public String getName() {
        return name;
    }
    
    /**
     * 根据状态值获取状态名称
     *
     * @param status 状态值
     * @return 状态名称
     */
    public static String getNameByStatus(Integer status) {
        if (status == null) {
            return "";
        }
        for (RecruitPlanStatusEnum statusEnum : values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum.getName();
            }
        }
        return "未知状态";
    }
    
    /**
     * 根据状态值获取枚举
     *
     * @param status 状态值
     * @return 枚举
     */
    public static RecruitPlanStatusEnum getByStatus(Integer status) {
        if (status == null) {
            return null;
        }
        for (RecruitPlanStatusEnum statusEnum : values()) {
            if (statusEnum.getStatus().equals(status)) {
                return statusEnum;
            }
        }
        return null;
    }
}
